/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tabelamodelcolumnmodel.banco;

import tabelamodelcolumnmodel.cliente.*;
import eloma.classe.Cliente;
import eloma.classe.banco.Banco;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Icaro
 */
public class BancoTableModel extends AbstractTableModel {

    private List<Banco> listBanco;
    private boolean ordenarPorNome = true;

    public BancoTableModel(List<Banco> listBanco) {
        this.listBanco = listBanco;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        Banco banco = listBanco.get(rowIndex);
        switch (columnIndex) {
            case 0:
                return banco.getNome();
        }

        return null;
    }

    @Override
    public int getRowCount() {
        return listBanco.size();
    }

    @Override
    public int getColumnCount() {
        return 2;
    }

    public Banco getValoresBanco(int rowIndex) {
        return listBanco.get(rowIndex);
    }

    public boolean isOrdenarPorNome() {
        return ordenarPorNome;
    }

    public void setOrdenarPorNome(boolean ordenarPorNome) {
        this.ordenarPorNome = ordenarPorNome;
    }

}
